package com.dragon.repository.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.dragon.repository.entity.Expenses;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ExpensesDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "自增id")
    private Integer id;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "类型：1常用类型 2管理费用 3工程支出")
    private Integer type;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateTime;

    @ApiModelProperty(value = "禁用状态：0启用1禁用")
    private Integer deleted;

    @ApiModelProperty(value = "报销类型金额")
    private Double reimburseTypeMoney;

    @ApiModelProperty(value = "报销类型百分比")
    private String reimburseTypeAvg;


    public ExpensesDTO() {}

    public ExpensesDTO(Expenses entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static ExpensesDTO convert(Expenses entity) {
        return new ExpensesDTO(entity);
    }

    public static List<ExpensesDTO> convertList(List<Expenses> list) {
        List<ExpensesDTO> resultList = new ArrayList<>();
        for (Expenses entity : list) {
            resultList.add(new ExpensesDTO(entity));
        }
        return resultList;
    }}
